function CTextButton(iXPos, iYPos, szText, szFont, szColor, iFontSize,oParentContainer) {

    var _aCbCompleted;
    var _aCbOwner;
    var _aCbKey;
    var _oButton;
    var _oParentContainer;

    this._init = function (iXPos, iYPos, szText, szFont, szColor, iFontSize) {

        _aCbCompleted = new Array();
        _aCbOwner = new Array();
        _aCbKey = new Array();

        var iStepShadow = Math.ceil(iFontSize / 20);

        var oTextBack = new createjs.Text(szText, "bold " + iFontSize + "px " + szFont, "#000000");
        oTextBack.textAlign = "left";
        var oBounds = oTextBack.getBounds();
        oTextBack.x = iStepShadow;
        oTextBack.y = iStepShadow;

        var oText = new createjs.Text(szText, "bold " + iFontSize + "px " + szFont, szColor);
        oText.textAlign = "left";
        oText.x = 0;
        oText.y = 0;
        var oBounds = oText.getBounds();

        _oButton = new createjs.Container();
        _oButton.x = iXPos;
        _oButton.y = iYPos;
        _oButton.addChild(oTextBack, oText);

        if (!s_bMobile)
            _oButton.cursor = "pointer";

        var hit = new createjs.Shape();
        hit.graphics.beginFill("#000").rect(0, 0, oBounds.width+iStepShadow, oBounds.height+iStepShadow);

        _oButton.hitArea = hit;
        _oParentContainer.addChild(_oButton);

        this._initListener();
    };

    this.unload = function () {
        _oButton.off("mousedown");
        _oButton.off("pressup");

        _oParentContainer.removeChild(_oButton);
    };

    this.setVisible = function (bVisible) {
        _oButton.visible = bVisible;
    };

    this._initListener = function () {
        oParent = this;

        _oButton.on("mousedown", this.buttonDown);
        _oButton.on("pressup", this.buttonRelease);
    };

    this.addEventListener = function (iEvent, cbCompleted, cbOwner, cbKey) {
        _aCbCompleted[iEvent] = cbCompleted;
        _aCbOwner[iEvent] = cbOwner;
        _aCbKey[iEvent] = cbKey;
    };

    this.buttonRelease = function () {
        _oButton.scaleX = 1;
        _oButton.scaleY = 1;

        playSound("click", 1, 0);

        if (_aCbCompleted[ON_MOUSE_UP]) {
            _aCbCompleted[ON_MOUSE_UP].call(_aCbOwner[ON_MOUSE_UP], _aCbKey[ON_MOUSE_UP]);
        }
    };

    this.buttonDown = function () {
        _oButton.scaleX = 0.9;
        _oButton.scaleY = 0.9;

        if (_aCbCompleted[ON_MOUSE_DOWN]) {
            _aCbCompleted[ON_MOUSE_DOWN].call(_aCbOwner[ON_MOUSE_DOWN], _aCbKey[ON_MOUSE_UP]);
        }
    };

    this.setPosition = function (iXPos, iYPos) {
        _oButton.x = iXPos;
        _oButton.y = iYPos;
    };

    this.setX = function (iXPos) {
        _oButton.x = iXPos;
    };

    this.setY = function (iYPos) {
        _oButton.y = iYPos;
    };

    this.getButtonImage = function () {
        return _oButton;
    };

    this.getX = function () {
        return _oButton.x;
    };

    this.getY = function () {
        return _oButton.y;
    };
    
    _oParentContainer=oParentContainer;
    
    this._init(iXPos, iYPos, szText, szFont, szColor, iFontSize);

    return this;

}